package School_manage;

public class Test {
    public static void main(String[] args) {
        // 创建学生管理器
        PersonManagerImpl<Student> studentManager = new PersonManagerImpl<>();
        // 新增学生
        studentManager.add(new Undergraduate_Stu("Richard", 22, 3, "3", "计算机"));
        studentManager.add(new Undergraduate_Stu("JiaQiYang", 21, 17, "3", "计算机"));


        // 创建老师管理器
        PersonManagerImpl<Teacher> teacherManager = new PersonManagerImpl<>();
        // 新增老师
        teacherManager.add(new Part_time_teacher("101", 35, 001, "Tencent"));
        teacherManager.add(new full_time_teacher("102", 38, 002, "教授"));

        // 输出所有学生
        System.out.println("=== 所有学生 ===");
        for (Student s : studentManager.getAll()) {
            System.out.println(s);
        }

        // 输出所有老师
        System.out.println("\n=== 所有老师 ===");
        for (Teacher t : teacherManager.getAll()) {
            System.out.println(t);
        }

        // 查找特定学生
        Student foundStudent = studentManager.findById(3);
        if (foundStudent != null) {
            System.out.println("\n=== 找到学生 ===");
            System.out.println(foundStudent);
        }

        // 删除学生
        boolean removed = studentManager.remove(2);
        System.out.println("\n=== 删除ID=2的学生: " + (removed ? "成功" : "失败"));

        // 再次列出学生
        System.out.println("\n=== 剩余学生 ===");
        for (Student s : studentManager.getAll()) {
            System.out.println(s);
        }
    }
}
